
package com.jf.cloud.api.feign;

import com.jf.cloud.api.vo.EsPageVO;
import com.jf.cloud.common.feign.FeignInsideAuthConfig;
import com.jf.cloud.common.order.dto.OrderSearchDTO;
import com.jf.cloud.common.order.vo.EsOrderVO;
import com.jf.cloud.common.order.vo.OrderItemVO;
import com.jf.cloud.common.order.vo.SendNotifyBO;
import com.jf.cloud.common.order.vo.UserOrderStatisticVO;
import com.jf.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

/**
 * 订单搜索
 * @author zz
 * @date 2021/02/05
 */
@FeignClient(value = "jfcloud-search",contextId = "searchOrder")
public interface SearchOrderFeignClient {

    /**
     * 统计用户的订单相关信息
     * @param userIds 用户id集合
     * @return 用户的订单相关统计数据
     */
    @PostMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/searchOrder/countOrderByUserIds")
    ServerResponseEntity<List<UserOrderStatisticVO>> countOrderByUserIds(@RequestBody List<Long> userIds);

    /**
     * 分页获取订单信息
     * @param orderSearchDTO
     * @return
     */
    @PostMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/searchOrder/pageOrder")
    ServerResponseEntity<EsPageVO<EsOrderVO>> pageOrder(@RequestBody OrderSearchDTO orderSearchDTO);

    /**
     * 获取订单数量
     * @param orderSearchDTO
     * @return
     */
    @PostMapping(value = FeignInsideAuthConfig.FEIGN_INSIDER_URL_PREFIX + "/searchOrder/countOrder")
    ServerResponseEntity<Long> countOrder(@RequestBody OrderSearchDTO orderSearchDTO);

    /**
     * 获取地区销量
     * @param orderSearchDTO
     * @return
     */
    @PostMapping(value = FeignInsideAuthConfig.FEIGN_INSIDER_URL_PREFIX + "/searchOrder/sumOrderGroupArea")
    ServerResponseEntity<List<Map<String,Object>>> sumOrderGroupArea(@RequestBody OrderSearchDTO orderSearchDTO);

    /**
     * 获取订单列表
     * @param orderIds
     * @return
     */
    @PostMapping(value = FeignInsideAuthConfig.FEIGN_INSIDER_URL_PREFIX + "/searchOrder/listOrderById")
    ServerResponseEntity<List<EsOrderVO>> listOrderById(@RequestBody List<Long> orderIds);

    /**
     * 获取订单列表
     * @param orderSearchDTO
     * @return
     */
    @PostMapping(value = FeignInsideAuthConfig.FEIGN_INSIDER_URL_PREFIX + "/searchOrder/listOrder")
    ServerResponseEntity<List<EsOrderVO>> listOrder(@RequestBody OrderSearchDTO orderSearchDTO);

    /**
     * 获取订单列表
     * @param orderItemIds
     * @return
     */
    @PostMapping(value = FeignInsideAuthConfig.FEIGN_INSIDER_URL_PREFIX + "/searchOrder/getOrderItems")
    ServerResponseEntity<List<OrderItemVO>> getOrderItems(@RequestBody List<Long> orderItemIds);

//    /**
//     * 获取订单中的金额信息，不包含退款
//     * @param orderIds 多个订单的订单id
//     * @return 订单商家id列表
//     */
//    @PostMapping(value = FeignInsideAuthConfig.FEIGN_INSIDER_URL_PREFIX + "/searchOrder/getOrdersSimpleAmountInfo")
//    ServerResponseEntity<List<OrderSimpleAmountInfoBO>> getOrdersSimpleAmountInfo(@RequestBody List<Long> orderIds);

    /**
     * 查询订单状态
     * @param orderIds 多个订单的订单id
     * @return 订单状态列表
     */
    @PostMapping(value = FeignInsideAuthConfig.FEIGN_INSIDER_URL_PREFIX + "/searchOrder/listSendNotifyBOByOrderIds")
    ServerResponseEntity<List<SendNotifyBO>> listSendNotifyByOrderIds(@RequestBody List<Long> orderIds);

    /**
     * 获取订单列表
     * @param orderSearchDTO
     * @return
     */
    @PostMapping(value = FeignInsideAuthConfig.FEIGN_INSIDER_URL_PREFIX + "/searchOrder/listEsOrder")
    ServerResponseEntity<List<EsOrderVO>> listEsOrder(@RequestBody OrderSearchDTO orderSearchDTO);
}
